package Thread;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author 杜伟毅
 * @version 1.0
 * @since 2024/08/24
 * 原子类操作
 */
public class AtomicIntegerTest {
    public static AtomicInteger atomicInteger=new AtomicInteger(0);

    public static void main(String[] args) {
        for (int i = 0; i < 200; i++) {
            new Thread(()->{
                ThreadUtils.sleep(20);
                atomicInteger.getAndIncrement();
            }).start();
        }

        ThreadUtils.sleep(3000);
        System.out.println(atomicInteger.get());
    }
}
